package ch.epfl.lara.pm.transformation;

import ch.epfl.lara.pm.ast._
import ch.epfl.lara.pm.global._

/**
 * XXX: TODO
 *      Actually it just fill in the class and object tables.
 */
object NameAnalyzer {

  def apply(tree: Tree): Unit = tree match {
    case Program(constr,clss,objs,main) => 
      clss.foreach(this(_))
      objs.foreach(this(_))
      
    case cd @ ClassDef(isAbstr,name,fields,superc,methods) =>
      ClassTable.addEntry(cd)
      
    case od @ ObjectDef(name,extractor) =>
      ObjectTable.addEntry(od)
      
    case _ => ()
  }
}
